package com.example;

/**
 * Created by lizhiyong on 2015/9/24.
 */
public class Calculate {

    public static void main(String[] args) {
        int width = 1080;
        int height = 1920;
        float size = 5.2f;

        System.out.println("width:" + width + ",height:" + height + ",size:" + size);
        // 对角线
        double diagonal = Math.sqrt(width * width + height * height);

        double ppi = diagonal / size;
        float widthdp = (float) (width / (ppi / 160));
        float heithdp = (float) (height / (ppi / 160));
        System.out.println("ppi:" + ppi + ",widthdp:" + widthdp + ",heightdp:" + heithdp);
    }
}
